package com.benjaminwan.read.free.ui.net

import androidx.paging.PageKeyedDataSource
import com.benjaminwan.read.free.model.bean.DetailBean

class DetailDataSource(private val netVM: NetViewModel) : PageKeyedDataSource<Int, DetailBean>() {

    override fun loadInitial(
        params: LoadInitialParams<Int>, callback: LoadInitialCallback<Int, DetailBean>
    ) {
        netVM.getThreadInit(netVM.initTid, netVM.initPage, params, callback)
    }

    override fun loadAfter(params: LoadParams<Int>, callback: LoadCallback<Int, DetailBean>) {
        netVM.getThreadAfter(netVM.initTid, params, callback)
    }

    override fun loadBefore(params: LoadParams<Int>, callback: LoadCallback<Int, DetailBean>) {
        //netVM.getThreadBefore(netVM.initTid, params, callback)
    }
}